# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-wakeonlan
pkgname=('python2-wakeonlan' 'python-wakeonlan')
_pkgname=wakeonlan
pkgver=3.1.0
pkgrel=2
pkgdesc='A small python module for wake on lan.'
arch=('any')
url='https://pypi.org/project/wakeonlan/#files'
license=('WTFPL')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('92d1e5e5b21a6df10ae19436610fd493fd850b55d6dd03e8b93c6a0be493ecc4d5b523ca3668437dcabb7f8883fa1ab2f0f30664c48c3f2da2f4cd8bb1816246')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-wakeonlan() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}2"
}

package_python-wakeonlan() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

